home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / util / rexx / XYZMesh.lha / XYZMesh.rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1998-09-22  |  3.1 KB  |  92 lines

  1. /*                        In the name of God                        *
  2. *                 XYZ Mesh Creator for LightWave Modeler            *
  3. * Author:                                                           *
  4. *                    _______________________________                *
  5. *                    *    Hossein Shirdashtzadeh   *                *
  6. *                    * (c)1998 All rights reserved *                *
  7. *                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                *
  8. * Purpose:                                                          *
  9. *   Used to import XYZ data from a text file into LightWave Modeler *
  10. *      (Please refer to the readme file comming with this script)   *
  11. *                                                                   *
  12. * Please send any suggestions to:                                   *
  13. * Snail:                                                            *
  14. *    No. 132, Kerdabad,                                          *
  15. *    Jey st., Isfahan,                                           *
  16. *    Iran                                                        *
  17. *    Zip code: 81599                                             *
  18. * Email:                                                            *
  19. *       shirdash@www.dci.co.ir                                      *
  20. *                                                                   *
  21. * --> "HSS" means: Hossein ShirdaShtzadeh                           *
  22. * Data Format:                                                      *
  23. *    Just the first two lines of your data file must contain the    *
  24. *    number of X amd Y data points in the mesh.                     *
  25. *    (See the example data file)                                    *
  26. *    After that you must write triples separated by a comma (,)     *
  27. *    These triples contain three floating point numbers indicating  *
  28. *    the coordinates of each mesh point in space. Note that each    *
  29. *    line contains only one triple and at the end of each line no   *
  30. *    comma is needed. (See the example data file)                   *
  31. *********************************************************************/
  32. options results
  33. ADDRESS "LWModelerARexx.port"
  34. libadd = addlib("LWModelerARexx.port",0)
  35.  
  36.  
  37. filename=getfilename("-- HSS MESH DATA --","Ram:" )
  38. if open(file,filename,'Read') then 
  39. do
  40.     mx= readln(file)
  41.     my= readln(file)
  42.     Triple = readln(file)        
  43.     x=get(Triple)
  44.     y=get(Triple)
  45.     z=get(Triple)
  46.  
  47. call meter_begin mx, 'HSS Mesh: Reading Points...'
  48. call add_begin
  49.  
  50.     do n=1 to mx
  51.     call meter_step
  52.     do m=1 to my
  53.         call add_point x y z
  54.         Triple = readln(file)        
  55.         x=get(Triple)
  56.         y=get(Triple)
  57.         z=get(Triple)
  58.         end
  59.     end
  60.     call meter_end
  61.     p=0
  62.     call meter_begin mx, 'HSS Mesh: Making Polygons...'
  63.     do n=1 to mx
  64.     call meter_step
  65.           do m=1 to my
  66.         p=p+1
  67.         k=p-1
  68.         if m>1 then call add_polygon p k
  69.         l=p-my
  70.         if l>0 then call add_polygon p l
  71.         end
  72.     end
  73.     call meter_end
  74.  
  75. call add_end
  76. end
  77.  
  78. exit
  79.  
  80.  
  81. /*********************************/
  82. Get:
  83. parse arg Triple
  84.     p=Triple
  85.     a=pos(',',Triple)-1
  86.     if a>0 then do
  87.         p=left(Triple,a)
  88.         Triple=right(Triple,length(Triple)-a-1)
  89.         end
  90.  
  91. Return p
  92.